# Maintainer: Ivan Semkin (ivan at semkin dot ru)

pkgname=ubuntu-download-manager-git
_pkgname=ubuntu-download-manager
pkgver=r2545.f0dea590
pkgrel=1
pkgdesc='Provides a service for downloading files while an application is suspended'
url='https://github.com/ubports/ubuntu-download-manager'
arch=(x86_64 i686 armv7h aarch64)
license=(LGPL)
conflicts=(ubuntu-download-manager)
provides=(ubuntu-download-manager)
depends=(boost dbus-test-runner gmock qt5-base qt5-declarative libnih google-glog)
makedepends=(git doxygen cmake cmake-extras-git gcovr lcov)
source=('git+https://github.com/ubports/ubuntu-download-manager.git#branch=xenial'
        'QtArg.patch')
sha256sums=('SKIP'
            '8182121308e04f60e29dfc1e3c8e221413b5a905ea1302e75acbe95a6bb7f866')

BUILDENV+=('!check') # Some tests are broken

prepare() {
  cd ${_pkgname}
  patch -Np1 -i "${srcdir}/QtArg.patch"
}

pkgver() {
  cd ${_pkgname}
  echo "r$(git rev-list --count HEAD).$(git describe --always)"
}

build() {
  cd ${_pkgname}
  cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_INSTALL_LIBDIR="lib/" -DCMAKE_INSTALL_LIBEXECDIR="lib/" .
  make
}

check() {
  cd ${_pkgname}
  make ARGS+="--output-on-failure" test
}

package() {
  cd ${_pkgname}
  make DESTDIR="${pkgdir}/" install
  mv ${pkgdir}/usr/lib/qt5/ ${pkgdir}/usr/lib/qt/
}
# vim:set ts=2 sw=2 et:
